#!/bin/bash -e

function info() {
echo Usage: `basename $0` 'cmd'
exit 2
}

while getopts  ":p:f:i:l:" opt; do
	case  $opt  in
		p) out_prefix=$OPTARG;;
		f) suffix=$OPTARG;;
        l) log_file=$OPTARG;;
        i) finish_id=$OPTARG;;
		*) info;;
	esac
done
shift $(($OPTIND - 1))


if [ $# -lt 1 ]; then info; fi

cmd=$1

test -z "$log_file" && log_file=.pid.log

test -e "$log_file" || :>$log_file

cat ${log_file} |grep -F "$1"|grep -F "${finish_id:=done}"
 